import {Injectable} from '@angular/core';
import {HttpClient} from '@angular/common/http';
import {Observable} from 'rxjs';
import {Env} from '../../../environments/Env';

@Injectable({
  providedIn: 'root'
})
export class TypeService {

  constructor(private http: HttpClient) {
  }

  public getTypeList(): Observable<any> {
    return this.http.get(`${Env.getDomain()}/blog/type/getAll`);
  }

  public getArticlesByType(params: any): Observable<any> {
    return this.http.get(`${Env.getDomain()}/blog/type/getByType`, {params});
  }

  public getArticleDetail(params): Observable<any> {
    return this.http.get(`${Env.getDomain()}/home/find`, {params});
  }
}
